| Conditions | 2 |
| Total Lines | 18 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { QueryHandler } from '@nestjs/cqrs'; |
||
| 13 | |||
| 14 | public async execute(query: GetSchoolUsersQuery): Promise<SchoolUserView[]> { |
||
| 15 | const schoolUserViews: SchoolUserView[] = []; |
||
| 16 | const schoolUsers = await this.schoolUserRepository.findUsersBySchool(query.schoolId); |
||
| 17 | |||
| 18 | for (const schoolUser of schoolUsers) { |
||
| 19 | const user = schoolUser.getUser(); |
||
| 20 | |||
| 21 | schoolUserViews.push( |
||
| 22 | new SchoolUserView( |
||
| 23 | schoolUser.getId(), |
||
| 24 | user.getEmail(), |
||
| 25 | 'schoolUser' |
||
| 26 | ) |
||
| 27 | ); |
||
| 28 | } |
||
| 29 | |||
| 30 | return schoolUserViews; |
||
| 31 | } |
||
| 33 |